<?php

namespace app\models;

use common\models\User;
use Yii;

/**
 * This is the model class for table "arc_progress".
 *
 * @property int $id 这个是每个CTI录音文件分类进度表id
 * @property int $arc_train 训练的表的外键关联
 * @property int $thing_recordfile 录音文件记录表的外键关联
 * @property int $progress 录音文件是否已经训练，未训练为0，已经训练为1，
 */
class ArcProgress extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'arc_progress';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['arc_train', 'thing_recordfile', 'progress'], 'required'],
            [['arc_train', 'thing_recordfile', 'progress'], 'integer'],
            [['thing_recordfile'], 'unique'],
            [['arc_language'], 'default','value'=>''],
            [['arc_classify'], 'default','value'=>0],
            [['arc_classify_status'], 'default','value'=>0],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '唯一编号',
            'arc_train' => '训练模型',
            'thing_recordfile' => '录音文件',
            'progress' => '文件是否存在',
            'arc_language' => '识别结果',
            'user' => '训练用户',
            'arc_classify_status' => '检测到是否有问题',
            'tall_area' => '来电归属地',
        ];
    }

    /**
     * 关联arc_progress
     */
    public function getArcClassify()
    {
        return $this->hasOne(ArcClassify::className(),['id' => 'arc_classify']);
    }

    /**
     * 关联ThingRecordFile
     */
    public function getThingRecordfile()
    {
        return $this->hasOne(ThingRecordFile::className(),['ID' => 'thing_recordfile']);
    }

    /**
     * 关联User
     */
    public function getUser()
    {
        return $this->hasOne(User::className(),['id' => 'user']);
    }
}
